package com.ds.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.HashMap;
import java.util.Map;

import lombok.Data;

@Data
@ApiModel("公司信息")
public class DSResult<T> {
	
	@ApiModelProperty(value="数据")
	public T data;

	@ApiModelProperty(value="提示信息")
	public String msg = " 执行失败";

	@ApiModelProperty(value="是否成功")
	public boolean success = false;
	
	@ApiModelProperty(value="总数")
	public Long count;
	
	@ApiModelProperty(value="状态码")
	public Long code;
	
	@ApiModelProperty(value="其他信息")
	public Map<String,Object> otherInfo = new HashMap<String,Object>();
	
	public void putOtherInfo(String key,Object value){
		otherInfo.put(key, value);
	}
	public DSResult(){
		this.success = true;
		this.msg = "执行成功";
	}
	
	public DSResult(T data) {
		super();
		this.data = data;
		this.success = true;
		this.msg = "执行成功";
	}
	
	public DSResult(String msg, boolean success) {
		super();
		this.msg = msg;
		this.success = success;
	}
	
	public DSResult(String msg, boolean success,T data) {
		super();
		this.msg = msg;
		this.success = success;
		this.data = data;
	}
	
	public DSResult(Long code) {
		super();
		this.code = code;
	}

}
